package com.jwthhealth_pub.old.common.Address;

import android.os.Parcel;
import android.os.Parcelable;

import com.j256.ormlite.field.DatabaseField;
import com.j256.ormlite.table.DatabaseTable;

/**
 * 收货地址
 * Created by 刘振 on 2017/5/5.
 */

@DatabaseTable(tableName = "cities")
public class Address implements Parcelable{
    @DatabaseField()
    private String cid;

    @DatabaseField()
    private String pid;

    @DatabaseField()
    private String spid;

    @DatabaseField()
    private String name;

//    @DatabaseField
    private String phone;

    private String province;

    private String city;

    private String coutry;

    private boolean isDefault;

    public boolean isDefault() {
        return isDefault;
    }

    public void setDefault(boolean aDefault) {
        isDefault = aDefault;
    }

    public String getProvince() {
        return province;
    }

    public void setProvince(String province) {
        this.province = province;
    }

    public String getCity() {
        return city;
    }

    public void setCity(String city) {
        this.city = city;
    }

    public String getCoutry() {
        return coutry;
    }

    public void setCoutry(String coutry) {
        this.coutry = coutry;
    }

    //    @DatabaseField
    private String detailAddress;

    public Address() {
    }

    public Address(String name, String phone, String province, String city, String coutry, String detailAddress) {
        this.name = name;
        this.phone = phone;
        this.province = province;
        this.city = city;
        this.coutry = coutry;
        this.detailAddress = detailAddress;
    }

    protected Address(Parcel in) {
        cid = in.readString();
        pid = in.readString();
        spid = in.readString();
        name = in.readString();
        phone = in.readString();
        detailAddress = in.readString();
        province = in.readString();
        city = in.readString();
        coutry = in.readString();
    }

    public static final Creator<Address> CREATOR = new Creator<Address>() {
        @Override
        public Address createFromParcel(Parcel in) {
            return new Address(in);
        }

        @Override
        public Address[] newArray(int size) {
            return new Address[size];
        }
    };

    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }

    public String getDetailAddress() {
        return detailAddress;
    }

    public void setDetailAddress(String detailAddress) {
        this.detailAddress = detailAddress;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getCid() {
        return cid;
    }

    public void setCid(String cid) {
        this.cid = cid;
    }

    public String getPid() {
        return pid;
    }

    public void setPid(String pid) {
        this.pid = pid;
    }

    public String getSpid() {
        return spid;
    }

    public void setSpid(String spid) {
        this.spid = spid;
    }

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel parcel, int i) {
        parcel.writeString(cid);
        parcel.writeString(pid);
        parcel.writeString(spid);
        parcel.writeString(name);
        parcel.writeString(phone);
        parcel.writeString(detailAddress);
        parcel.writeString(province);
        parcel.writeString(city);
        parcel.writeString(coutry);
    }
}
